//
//  QDOriginPageViewController.swift
//  QDMetroClient
//
//  Created by YueWen on 2019/3/1.
//  Copyright © 2019 YueWen. All rights reserved.
//

import UIKit

/// 搭载 QDOriginTitleTableViewController 的 pageController
class QDOriginPageViewController: NWViewController {
    
    /// 滚动视图
    let pageController = RITLScrollHorizontalPageViewController()
    
    /// 顶部的titles
    var titles: [String] {
        get {
            return []
        }
    }
    /// 承载的viewController
    var pageControllers: [UIViewController] {
        get {
            return []
        }
    }
    
    /// 子类可以进行segment进行配置
    func configSegment(){}
    

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        //追加控制器
        addChild(pageController)
        view.addSubview(pageController.view)
        pageController.view.snp.makeConstraints { (make) in
            make.left.bottom.right.equalToSuperview()
            make.top.equalToSuperview().offset(BarDistance.NavigationBar.height)
        }
    
        pageController.segmentBar.update { (config) in
            
            let _ = config?.itemNormalColor(QDColors.black)?
                    .itemSelectColor(QDColors.theme)?
                    .indicatorColor(QDColors.theme)?
                    .indicatorHeight(2)?
                    .itemFont(Font.regular.font(size: 15))
        }
        
        pageController.segmentBar.isSimpleView = true
        pageController.segmentBar.borderMarginInset = UIEdgeInsets(top: 0, left: 56, bottom: 0, right: 56)
        
        configSegment()
        pageController.segmentBar.items = titles
        pageController.contentViewControllers = pageControllers
        
    }
    
    override var nav_barShadowHidden: Bool { return true }
    

}
